package com.net.xpay.admin.controller.admin;

import com.google.common.base.Preconditions;
import com.net.common.model.ResultPagedList;
import com.net.xpay.common.domain.BookAccountLargeDepositChargeOrder;
import com.net.xpay.common.manager.BookAccountLargeDepositChargeOrderManager;
import com.net.xpay.common.model.search.BookAccountLargeDepositChargeOrderSearchModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**

 */
@RestController
@Slf4j
@RequestMapping("/admin/safe-pay-book-account-large-deposit-charge-order")
@Api(tags = "后台/安全付备付金汇款充值记录", description = "后台 安全付备付金汇款充值记录 net")
public class AdminBookAccountLargeDepositChargeOrderController {
    @Autowired
    private BookAccountLargeDepositChargeOrderManager bookAccountLargeDepositChargeOrderManager;

    /**
     * 分页
     */
    @ApiOperation("分页")
    @PostMapping("/search")
    @ResponseBody
    @PreAuthorize("hasAnyRole('ADMIN', 'safe-pay-book-account-large-deposit-charge-order::search')")
    public ResultPagedList<BookAccountLargeDepositChargeOrder> search(@RequestBody BookAccountLargeDepositChargeOrderSearchModel searchModel) {
        Preconditions.checkArgument(searchModel != null);
        List<BookAccountLargeDepositChargeOrder> records = bookAccountLargeDepositChargeOrderManager.search(searchModel);

        long count = bookAccountLargeDepositChargeOrderManager.searchCount(searchModel);

        return new ResultPagedList<>(records, count, searchModel);
    }
}
